package com.ymatou.query.trading.api.testcase;

import java.util.ArrayList;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetOrderCountOfProductIdListBean;
import com.ymatou.query.trading.api.service.GetOrderCountOfProductIdListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.utils.constant.ECode;

/**
 * 根据商品id列表获取订单数量 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetOrderCountOfProductIdList {

	private static GetOrderCountOfProductIdListBean getordercountofproductidlistbean;
	private static GetOrderCountOfProductIdListCall getordercountofproductidlistcall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("根据商品id列表获取订单数量");
	}

	@Before
	public void caseUp() {

		getordercountofproductidlistbean = new GetOrderCountOfProductIdListBean();
		getordercountofproductidlistcall = new GetOrderCountOfProductIdListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getordercountofproductidlistcall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderCountOfProductIdList_001() {
		Logger.start(true,"根据商品id列表获取订单数量成功");
		try {
			// 参数
			ArrayList<String> list = new ArrayList<String>();
			list.add("f7db7df7-29ce-4aa2-b722-02a0866f5999");
			list.add("e927f6cf-d7c0-45c6-bc1d-4df3d45001af");
			list.add("00004391-263d-4d3e-9af3-c99c9929c3c6");
			getordercountofproductidlistbean.setProductIdList(list);
			// 发送请求
			getordercountofproductidlistcall.setData(getordercountofproductidlistbean);
			getordercountofproductidlistcall.callService();
			Logger.comment("getordercountofproductidlistcall send:"
					+ getordercountofproductidlistcall.getEntityString());
			Logger.comment("getordercountofproductidlistcall response:"
					+ getordercountofproductidlistcall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getordercountofproductidlistcall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getordercountofproductidlistcall.getMsg(), "验证Msg");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}